package com.mvc.service.impl;

import com.mvc.dao.DogDao;
import com.mvc.dao.impl.DogDaoImpl;
import com.mvc.entity.Dog;
import com.mvc.service.DogService;

import java.util.List;

/**
 * @author wzm
 * @create 2023-04-12 16:35
 */
public class DogServiceImpl implements DogService {
    //dao已经做好了所有的方法 只需要组合调用即可
    //上层调下层
    private DogDao dogDao = new DogDaoImpl();

    @Override
    public boolean add(Dog dog) {
        return dogDao.insert(dog) > 0;
    }

    @Override
    public boolean remove(Dog dog) {
        return dogDao.delete(dog) > 0;
    }

    @Override
    public boolean modify(Dog dog) {
        return dogDao.update(dog) > 0;
    }

    @Override
    public Dog findById(Dog dog) {
        return dogDao.selectById(dog);
    }

    @Override
    public List<Dog> findByAll() {

        return dogDao.selectByList();
    }
}
